package com.simpou.tests.rest.helper;

import com.simpou.commons.utils.lang.Conditionals;
import com.simpou.commons.utils.lang.JaxbHelper;
import com.sun.jersey.api.client.ClientResponse;
import java.io.StringReader;

import java.util.List;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;


/**
 * Utilitários para testes sobre a resposta do servidor.
 *
 * @author Jonas Pereira
 * @since 2013-03-12
 */
public class ClientResponseHelper {
    /**
     * @param response Resposta enviada pelo servidor REST.
     * @return Se objeto retornado veio do cache.
     */
    public static boolean fromCache(final ClientResponse response) {
        if (response == null) {
            return false;
        }
        final List<String> etags = response.getHeaders().get("ETag");
        return Conditionals.isNotEmpty(etags);
    }
    
}
